
//
//  AboutUI.m
//  NRWMall
//
//  Created by 邢毅 on 2018/5/9.
//  Copyright © 2018年 com.anpxd. All rights reserved.
//

#import "AboutUI.h"

CGFloat IphoneX_Bottom(void){
    if (SCREEN_WIDTH() == 812) {
        return 25;
    }else{
        return 5;
    }
}

CGFloat SCREEN_WIDTH(void) {
    return [UIScreen mainScreen].bounds.size.width;
}

CGFloat SCREEN_HEIGHT(void) {
    return [UIScreen mainScreen].bounds.size.height;
}

CGFloat getNavHeight(void) {
    return SCREEN_HEIGHT() == 812.0? 84.0: 64.0;
}

CGFloat getSafeTopMargin(void) {
    return SCREEN_HEIGHT() == 812? 20: 0;
}

CGFloat getTabBarHeight(void) {
    return SCREEN_HEIGHT() == 812? 83: 49;
}

CGFloat getSafeBottomMargin(void) {
    return SCREEN_HEIGHT() == 812? 34: 0;
}

CGFloat SCREEN_WIDTH_SCALE(void) {
    return SCREEN_WIDTH() / 375.0;
}

CGFloat SCREEN_HEIGHT_SCALE(void) {
    return SCREEN_HEIGHT() / 667.0;
}

CGFloat getAdaptationWidth(CGFloat designWidth) {
    return designWidth * SCREEN_WIDTH_SCALE();
}

CGFloat getAdaptationHeight(CGFloat designHeight) {
    return designHeight * SCREEN_HEIGHT_SCALE();
}

UIFont *getThemeFont(CGFloat fontSize) {
    return [UIFont fontWithName:@"PingFangSC-Regular" size:fontSize];
}

UIFont *getBoldFont(CGFloat fontSize){
    return [UIFont boldSystemFontOfSize:fontSize];
}

UIColor *getColor(NSString *colorStr) {
    NSString *cString = [[colorStr stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
    
    if ([cString length] < 6) return [UIColor whiteColor];
    if ([cString hasPrefix:@"#"]) cString = [cString substringFromIndex:1];
    if ([cString length] != 6) return [UIColor whiteColor];
    
    NSRange range;
    range.location = 0;
    range.length = 2;
    NSString *rString = [cString substringWithRange:range];
    
    range.location = 2;
    NSString *gString = [cString substringWithRange:range];
    
    range.location = 4;
    NSString *bString = [cString substringWithRange:range];
    
    
    unsigned int r, g, b;
    [[NSScanner scannerWithString:rString] scanHexInt:&r];
    [[NSScanner scannerWithString:gString] scanHexInt:&g];
    [[NSScanner scannerWithString:bString] scanHexInt:&b];
    
    return [UIColor colorWithRed:((float) r / 255.0f)
                           green:((float) g / 255.0f)
                            blue:((float) b / 255.0f)
                           alpha:1.0f];
}

UIImage *getImage(NSString *imageName) {
    if (isNotEmptyString(imageName)) {
        return [UIImage imageNamed:imageName];
    } else {
        return nil;
    }
}
UIColor *mainColor(void){
    
    return getColor(@"#FF6816");
}
UIColor *lineColor(void){
    
    return getColor(@"e9e9e9");
}
UIColor *backColor(void){
    
    return getColor(@"f9f9f9");
}
UIColor *mainFontColor(void){
    
    return getColor(@"323232");
}
UIColor *subFontColor(void){
    
    return getColor(@"989898");
}
UIColor *lightFontColor(void){
    
    return getColor(@"b2b2b2");
}
UIColor *whiteColor(void){
    
    return getColor(@"ffffff");
}

